package com.tuanzi.loan.business.service.receipt.order.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuanzi.loan.business.entity.receipt.order.ReceiptOrder;
import com.tuanzi.loan.business.repository.receipt.order.ReceiptOrderRepository;
import com.tuanzi.loan.business.service.receipt.order.ReceiptOrderService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.service.CommonServiceImpl;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Ray 2017/09/21
 */
@Debug
@Slf4j
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class ReceiptOrderServiceImpl extends CommonServiceImpl<ReceiptOrder, Long> implements ReceiptOrderService {

	@Autowired
	private ReceiptOrderRepository receiptOrderRepository;

	@Override
	public List<ReceiptOrder> findAllByCommitTimeBetween(Date start, Date end) {
		return receiptOrderRepository.findAllByCommitTimeBetween(start, end);
	}

	@Override
	protected JpaRepository<ReceiptOrder, Long> getRepository() {
		return receiptOrderRepository;
	}
}
